/**
* Created by wl
* 项目管理>持有中-详情页-高管/股东-公司高管信息
*/
<template>
    <div class="ca-box ca-box-border-top-none ca-p-20">
        <div v-if="!showEdit">
            <div class="ca-title">
                <h3>公司高管</h3>
                <el-button type="text" class="ca-edit-btn el-icon-edit ca-m-r-10 edit-btn" @click="editInfo" :disabled="!isAuthIndexSee">编辑</el-button>
                <div class="clear"></div>
            </div>
            <el-table
                :data='itemHoldHighManagerEntities'
                class="ca-table table_p_01 el-wid-100 ca-m-t-15">
                <el-table-column
                    label="高管姓名"
                    prop="userName"
                    align="center"
                    >
                </el-table-column>
                <el-table-column
                    label="性别"
                    prop="sex"
                    align="center"
                    >
                </el-table-column>
                <el-table-column
                    prop="position"
                    label="职位"
                    align="center"
                    >
                </el-table-column>
                <el-table-column
                    prop="phone"
                    label="电话"
                    align="center"
                    >
                </el-table-column>
                <el-table-column
                    prop="email"
                    label="邮箱"
                    align="center"
                    >
                </el-table-column>
                <el-table-column
                    prop="fax"
                    label="传真"
                    align="center"
                    >
                </el-table-column>
                <el-table-column
                    prop="note"
                    label="备注"
                    align="center"
                    width="200px">
                    <template slot-scope="scope">
                        <el-tooltip class="item" effect="dark" :content="scope.row.note" placement="top">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.note}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <csExecutive v-else :showBtn="true" @close="close" @save="save"></csExecutive>
    </div>
</template>
<script type="text/ecmascript-6">
    import {api} from '../../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import { addRemind, isNoAuth } from '__service/utils';
    export default {
        data() {
            return {
                isAuthIndexSee: isNoAuth('持有中项目-高管/股东-编辑'),
                showEdit: false,
                value: '',
                itemHoldHighManagerEntities: [
                    {
                        email: '', //邮箱
                        fax: '',//传真 ,
                        id: '',//id ,
                        itemId: '',//项目ID ,
                        phone: '',//电话 ,
                        position: '',//职位 ,
                        sex: '',//性别 直接传 : 男 女 ,
                        userName: '',//名字
                        note: '', //备注
                    }
                ],
            }
        },
        watch: {
        },
        props: {},
        mounted() {
            this.getInfo()
        },
        methods: {
            editInfo() {
                this.showEdit = true
            },
            close() {
                this.showEdit = false
            },
            async save() {
                this.showEdit = false
                await this.getInfo();
                // 添加小红点
                await addRemind({
                    dataId: this.$route.params.itemId, // 业务id
                    dataTab: 1, // tab页顺序 head 也为0 新建为'-1'
                    dataType: 2, // 1拟投资项目,2已投资项目,3母基金,4拟设立基金,5已设立基金,6客户,7潜在项目
                });
                // 根据第三方组件来调用 父组件中定义的方法 重新获取小红点
                this.$root.Dot.$emit('getDotList');
                // 添加小红点 end
            },
            getInfo() {
                apiHttp(api.CHECK_HIGHMANAGER, {itemId: this.$route.params.itemId}).then(ret=> {
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.itemHoldHighManagerEntities = ret.data
                    }
                })
            },
        },
        components: {
            csExecutive: require('./edit'),
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.edit-btn {
    float: right;
    cursor: pointer;
}
.el-ellipsis {
    width: 250px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ca-notes {
    color: #666;
}
</style>